package core;

import java.io.IOException;
import java.io.NotSerializableException;
import java.util.Vector;
import utils.FileIO;

public class testFileIO
{

	/**
	 * @param args
	 * @throws IOException
	 * @throws NotSerializableException
	 * @throws IOException
	 * @throws NotSerializableException
	 * @throws ClassNotFoundException
	 * @throws ClassNotFoundException
	 */
	public static void main(String[] args) throws NotSerializableException,
			IOException, ClassNotFoundException
	{
		Vector<Unit> units = new Vector<Unit>();
		units.add(new UVehicle("Predator", 4, 13, 11, 10, 1, 200,
				"Heavy Support", null));

		/*
		 * units.add(new USquadTroop("Apothecary", 4, 4, 4, 4, 1, 4, 2, 9, 3, 1,
		 * 100, null));
		 */

		units.add(new UWalker("Dreadnought", 4, 4, 6, 12, 12, 10, 4, 2, 1, 200,
				"Elite", null));
		Codex testCodex = new Codex("Space Marines", units);

		System.out.println(testCodex);

		// FileIO.writeObject(testCodex, "Space Marines.b40k");
		Object newCodex = FileIO.readObject("Space Marines.b40k");
		Codex newerCodex = (Codex) newCodex;
		System.out.println(newerCodex);
		System.out.println(units.get(0).getCost() + " = "
				+ newerCodex.getUnits().get(0).getCost());
	}

}
